
<page-container>
  <page-summary-box>
    <page-summary-item text="存储名称"><span ng-bind="storageInstance.name"></span></page-summary-item>
    <page-summary-item text="存储类型"><span ng-bind="storageInstance.type.toLowerCase()"></span></page-summary-item>
    <page-summary-item text="创建时间"><span ng-bind="storageInstance.createTime | time"></span></page-summary-item>
    <page-summary-content ng-if="mayDelete()">
      <button type="button" ng-click="deleteStorage(storageInstance.id)">删除</button>
    </page-summary-content>
  </page-summary-box>
  <page-content-box ng-if="mayDelete()" tabs="[{text: '部署详情', page: '', html: 'podDetail.html'}, {text: '成员', page: 'user', html: 'user.html', lazy: !1}]"></page-content-box> 
  <page-content-box ng-if="!mayDelete()" tabs="[
    { text: &quot;部署详情&quot;, page: &quot;&quot;, html: &quot;podDetail.html&quot; },
    { text: &quot;成员&quot;, page: &quot;user&quot;, lazy: false, html: &quot;user.html&quot; }
    ]"></page-content-box>
</page-container>
<script type="text/ng-template" id="podDetail.html">
<form-container>
  <table class="ui-table-dome">
      <thead>
        <tr>
          <th>部署名称</th>
		  <th>部署版本</th>
		  <th>namespace</th>
		  <th>集群</th>         
        </tr>
      </thead>
      <tbody>
		<tr ng-if="!deployDetail||deployDetail.length===0">
          <td colspan="6">无部署信息</td>
        </tr>
        <tr ng-repeat="instance in deployDetail">
          <td ng-cloak="ng-cloak">{{instance.deployName}}</td>
          <td ng-cloak="ng-cloak">{{instance.versionName}}</td>
		  <td ng-cloak="ng-cloak">{{instance.namespace}}</td>
	      <td ng-cloak="ng-cloak">{{instance.clusterName}}</td>
        </tr>
      </tbody>
    </table>
</form-container>
</script>
<script type="text/ng-template" id="podDetail2.html">
  <form-container>
    <form>
      <form-multiple-inline content-type="search">
        <form-multiple-inline-item>
          <form-search-box-with-count text-prefix="共" text-suffix="条信息" ng-model="volumeInfo.searchKeyword" total="{{ volumeInfo.volumeList.length }}" match="{{ volumeInfo.filteredVolumeList.length }}" on-change="filterVolumeList()" placeholder="搜索名称"></form-search-box-with-count>
        </form-multiple-inline-item>
      </form-multiple-inline>
      <form-table ng-model="deployDetail" template="storageVolumeTable" columns="[
          { text: '部署名称', key: 'name'},
          { text: '部署版本', key: 'version'},
          { text: '集群', key: 'clusterName'},
          { text: 'namespace', key: 'namespace'},
          ]" on-delete="deleteVolume(data)" no-delete="noDeleteList" empty-text="{{isVolumeLoading ? '正在获取列表，请稍候' : (searchText ? '无匹配信息' : '无信息') }}" param="{storageId: resourceId}"></form-table>
      <script type="text/ng-template" id="storageVolumeTable">
        <div ng-if="column.key === 'name'"><a class="ui-table-link" ui-sref="storageVolumeDetail({storageId: param.storageId, volumeId: row.storageVolumeDraft.id})"><span ng-bind="row.storageVolumeDraft.name"></span></a></div>
        <div ng-if="column.key === 'version'" ng-bind="row.version"></div>
        <div ng-if="column.key === 'clusterName'" ng-bind="row.clusterName"></div>
        <div ng-if="column.key === 'namespace'" ng-bind="row.namespace"></div>
      </script>
    </form>
  </form-container>
</script>
<script type="text/ng-template" id="detail.html">
  <div class="dome-option-container" style="margin-bottom:0;">	
    <button class="ui-btn ui-btn-bright ui-btn-sm" ng-if="!isEditStorage" ng-click="toggleIsEditStorage('edit')" ng-disabled="!mayPost()" ng-class="{'ui-btn-lg-disabled':!mayPost()}">编辑</button>
    <button class="ui-btn ui-btn-bright ui-btn-sm" ng-if="isEditStorage" ng-click="saveEditStorage()" ng-disabled="isRunning">保存</button>
    <button class="ui-btn ui-btn-bright ui-btn-sm" ng-if="isEditStorage" ng-click="toggleIsEditStorage()" ng-disabled="isRunning">取消</button>
  </div>
  <div class="dome-prompt-container">
    <dome-prompt content="当该存储集群已存在数据卷时，仅支持修改存储名称和描述信息"></dome-prompt>
  </div>
  <form-container left-column-width="80px">
    <form-config-group ng-if="!isEditStorage">
      <form-config-item config-title="存储名称">
        <form-input-container><span ng-bind="storageInstance.name"></span></form-input-container>
      </form-config-item>
      <form-config-item config-title="存储描述">
        <form-input-container><span ng-bind="storageInstance.description || '无描述信息'"></span></form-input-container>
      </form-config-item>
      <form-config-item config-title="存储类型">
        <form-input-container><span ng-bind="storageInstance.storageType.toLowerCase()"></span>
          <sub-form-container left-column-width="80px" ng-if="storageInstance.storageType === 'GLUSTERFS'">
            <form-config-group>
              <form-config-item config-title="节点IP">
                <form-input-container ng-repeat=" ip in storageInstance.storageInfo.ips track by $index"><span ng-bind="ip"></span></form-input-container>
              </form-config-item>
            </form-config-group>
          </sub-form-container>
          <sub-form-container left-column-width="80px" ng-if="storageInstance.storageType === 'CEPHFS'">
            <form-config-group>
              <form-config-item config-title="User">
                <form-input-container><span ng-bind="storageInstance.storageInfo.cephUser"></span></form-input-container>
              </form-config-item>
              <form-config-item config-title="Keyring">
                <form-input-container><span ng-bind="storageInstance.storageInfo.keyring"></span></form-input-container>
              </form-config-item>
              <form-config-item config-title="Monitor IP">
                <form-input-container ng-repeat=" ip in storageInstance.storageInfo.cephMonitors track by $index"><span ng-bind="ip"></span></form-input-container>
              </form-config-item>
            </form-config-group>
          </sub-form-container>
        </form-input-container>
      </form-config-item>
      <form-config-item config-title="管理器">
        <form-input-container>
          <sub-form-container left-column-width="80px">
            <form-config-group>
              <form-config-item config-title="管理器地址">
                <form-input-container><span ng-bind="storageInstance.storageManagerInfo.host || '无'"></span></form-input-container>
              </form-config-item>
              <form-config-item config-title="access key">
                <form-input-container>
                  <textarea ng-model="storageInstance.storageManagerInfo.accesskey" readonly="readonly"></textarea>
                </form-input-container>
              </form-config-item>
              <form-config-item config-title="secret key">
                <form-input-container>
                  <textarea ng-model="storageInstance.storageManagerInfo.secretkey" readonly="readonly"></textarea>
                </form-input-container>
              </form-config-item>
            </form-config-group>
          </sub-form-container>
        </form-input-container>
      </form-config-item>
    </form-config-group>
    <form name="storageDetail" ng-if="isEditStorage">
      <form-config-group>
        <form-config-item config-title="存储名称">
          <form-input-container>
            <input name="storage-name" type="text" placeholder="名称唯一，不可重复" ng-model="storageInstance.name" required="required"/>
            <form-error-message form="storageDetail" target="storage-name">名称不能为空</form-error-message>
          </form-input-container>
        </form-config-item>
        <form-config-item config-title="存储描述">
          <form-input-container>
            <textarea ng-model="storageInstance.description" style="padding: 6px 20px;line-height:20px;display: block;"></textarea>
          </form-input-container>
        </form-config-item>
        <form-config-item config-title="存储类型">
          <form-input-container ng-if="!hasVolume"><span ng-bind="storageInstance.storageType.toLowerCase()"></span>
            <sub-form-container left-column-width="80px" ng-if="storageInstance.storageType === 'GLUSTERFS'">
              <form-config-group>
                <form-config-item config-title="节点IP" required="required">
                  <form-input-container help-text="请准确填写节点IP信息，以避免存储挂载失败。">
                    <form-array-container ng-model="storageInstance.storageInfo.ips" template="formArrayItemForIP" max-length="100" min-length="1" type="simple"></form-array-container>
                  </form-input-container>
                </form-config-item>
              </form-config-group>
            </sub-form-container>
            <sub-form-container left-column-width="80px" ng-if="storageInstance.storageType === 'CEPHFS'">
              <form-config-group>
                <form-config-item config-title="User" required="required">
                  <form-input-container>
                    <input type="text" placeholder="" ng-model="storageInstance.storageInfo.cephUser" required="required"/>
                  </form-input-container>
                </form-config-item>
                <form-config-item config-title="Keyring" required="required">
                  <form-input-container>
                    <input type="text" placeholder="" ng-model="storageInstance.storageInfo.keyring" required="required"/>
                  </form-input-container>
                </form-config-item>
                <form-config-item config-title="Monitor IP" required="required">
                  <form-input-container help-text="请准确填写Monitor IP信息，以避免存储挂载失败。">
                    <form-array-container ng-model="storageInstance.storageInfo.cephMonitors" template="formArrayItemForIP" max-length="100" min-length="1" type="simple"></form-array-container>
                  </form-input-container>
                </form-config-item>
              </form-config-group>
            </sub-form-container>
          </form-input-container>
          <form-input-container ng-if="hasVolume"><span ng-bind="storageInstance.storageType.toLowerCase()"></span>
            <sub-form-container left-column-width="80px" ng-if="storageInstance.storageType === 'GLUSTERFS'">
              <form-config-group>
                <form-config-item config-title="节点IP">
                  <form-input-container ng-repeat=" ip in storageInstance.storageInfo.ips track by $index"><span ng-bind="ip"></span></form-input-container>
                </form-config-item>
              </form-config-group>
            </sub-form-container>
            <sub-form-container left-column-width="80px" ng-if="storageInstance.storageType === 'CEPHFS'">
              <form-config-group>
                <form-config-item config-title="User">
                  <form-input-container><span ng-bind="storageInstance.storageInfo.cephUser"></span></form-input-container>
                </form-config-item>
                <form-config-item config-title="Keyring">
                  <form-input-container><span ng-bind="storageInstance.storageInfo.keyring"></span></form-input-container>
                </form-config-item>
                <form-config-item config-title="Monitor IP">
                  <form-input-container ng-repeat=" ip in storageInstance.storageInfo.cephMonitors track by $index"><span ng-bind="ip"></span></form-input-container>
                </form-config-item>
              </form-config-group>
            </sub-form-container>
          </form-input-container>
        </form-config-item>
        <form-config-item config-title="管理器" required="required">
          <form-input-container help-text="管理器负责在存储集群上创建、删除目录，并查询目录信息。">
            <sub-form-container left-column-width="80px">
              <form-config-group>
                <form-config-item config-title="管理器地址">
                  <form-input-container>
                    <input type="text" name="storageManagerHost" ng-model="storageInstance.storageManagerInfo.host" placeholder="请输入ip:port或者域名" required="required"/>
                  </form-input-container>
                </form-config-item>
                <form-config-item config-title="access key">
                  <form-input-container>
                    <textarea type="text" name="storageManagerAccessKey" ng-model="storageInstance.storageManagerInfo.accesskey" required="required"></textarea>
                  </form-input-container>
                </form-config-item>
                <form-config-item config-title="secret key">
                  <form-input-container>
                    <textarea type="text" name="storageManagerSecretKey" ng-model="storageInstance.storageManagerInfo.secretkey" required="required"></textarea>
                  </form-input-container>
                </form-config-item>
              </form-config-group>
            </sub-form-container>
          </form-input-container>
        </form-config-item>
      </form-config-group>
    </form>
  </form-container>
  <script type="text/ng-template" id="formArrayItemForIP">
    <input type="text" ng-model="$ctrl.ngModel[$index]" required="required"/>
  </script>
</script>
<script type="text/ng-template" id="user.html">
  <form-container left-column-width="0">
    <form>
      <collection-member-table collection-id="resourceId" collection-type="resourceType" on-role-change="setRole(role)" on-no-permission="exitToList()" help-text="MASTER权限的成员可以关联、查看、修改、删除存储；可以在存储中添加、查看、删除数据卷；有DEVELOPER权限的成员可以关联、查看、修改存储，可以在存储中添加、查看数据卷；有REPORTER权限的成员可以查看存储。添加、修改或删除存储成员需要MASTER权限。"></collection-member-table>
    </form>
  </form-container>
</script>